package com.ruoyi.purchase.service.impl;

import com.ruoyi.purchase.domain.Supplier;
import com.ruoyi.purchase.mapper.SupplierMapper;
import com.ruoyi.purchase.service.ISupplierService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * SupplierService业务层处理
 * 
 * @author kevinness
 * @date 2025-02-02
 */
@Service
public class SupplierService implements ISupplierService
{
    @Autowired
    private SupplierMapper supplierMapper;

    /**
     * 查询Supplier
     * 
     * @param supplierCode Supplier主键
     * @return Supplier
     */
    @Override
    public Supplier selectSupplierBySupplierCode(String supplierCode)
    {
        return supplierMapper.selectSupplierBySupplierCode(supplierCode);
    }

    /**
     * 查询Supplier列表
     * 
     * @param supplier Supplier
     * @return Supplier
     */
    @Override
    public List<Supplier> selectSupplierList(Supplier supplier)
    {
        return supplierMapper.selectSupplierList(supplier);
    }

    /**
     * 新增Supplier
     * 
     * @param supplier Supplier
     * @return 结果
     */
    @Override
    public int insertSupplier(Supplier supplier)
    {
        return supplierMapper.insertSupplier(supplier);
    }

    /**
     * 修改Supplier
     * 
     * @param supplier Supplier
     * @return 结果
     */
    @Override
    public int updateSupplier(Supplier supplier)
    {
        return supplierMapper.updateSupplier(supplier);
    }

    /**
     * 批量删除Supplier
     * 
     * @param supplierCodes 需要删除的Supplier主键
     * @return 结果
     */
    @Override
    public int deleteSupplierBySupplierCodes(String[] supplierCodes)
    {
        return supplierMapper.deleteSupplierBySupplierCodes(supplierCodes);
    }

    /**
     * 删除Supplier信息
     * 
     * @param supplierCode Supplier主键
     * @return 结果
     */
    @Override
    public int deleteSupplierBySupplierCode(String supplierCode)
    {
        return supplierMapper.deleteSupplierBySupplierCode(supplierCode);
    }

    /**
     * 根据用户名查询供货商信息
     *
     * @param username 用户名
     * @return 供货商信息
     */
    @Override
    public Supplier selectSupplierInfoByUsername(String username){
        return supplierMapper.selectSupplierInfoByUsername(username);
    }

    /**
     * 根据供货商名查询供货商编码
     *
     * @param companyName 用户名
     * @return 供货商编码
     */
    @Override
    public String selectSupplierCodeByCompanyName(String companyName) {
        return supplierMapper.selectSupplierCodeByCompanyName(companyName);
    }
}
